﻿@model ConferenceRegister.Domain.Register

@{
    ViewBag.Title = "Edit Registrant";
}

@Html.Partial("_Conference", @Model.Conference)

<h1>Edit <span>Registrant</span></h1>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    @Html.HiddenFor(model => model.ConferenceID)
    @Html.HiddenFor(model => model.SeatID)
    @Html.HiddenFor(model => model.PaymentDate)
    @Html.HiddenFor(model => model.IsLocalPickup)
    @Html.HiddenFor(model => model.SubmitDate)
    @Html.HiddenFor(model => model.DeliverDate)

    <h2>Payment Received</h2>
    
    <div class="editor-field">
        @Html.DropDownListFor(model => model.PaymentType, new SelectList(new string[] {"Cheque", "DD", "Cash"}), "Select a payment type" )
        @Html.ValidationMessageFor(model => model.PaymentType)
        @Html.EditorFor(model => model.PaymentNumber)
        @Html.ValidationMessageFor(model => model.PaymentNumber)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.PaymentAmount)
        @Html.ValidationMessageFor(model => model.PaymentAmount)
        @if (@Model.PaymentDate != null)
    {
            @:Fully paid on <span class="light">@Model.PaymentDate.Value.ToShortDateString()</span>
    }
    </div>    
    <div class="editor-field">
        @Html.CheckBox("IsDelivered", @Model.DeliverDate != null)
        @Html.Label("IsDelivered", "Sent bracelet?")
        @if (@Model.DeliverDate != null)
    {
            @:Delivered on <span class="light">@Model.DeliverDate.Value.ToShortDateString()</span>
    }
    </div>
        <input type="submit" value="Save" />
    <h2>Summary</h2>
    string ministry = Model.MinistrySignup == null ? "None" : Model.MinistrySignup.Ministry.Name;
    <table class="compact">
        <tr><td>Seat</td><td><span class="light">@Model.Seat.Name</span></td></tr>
        <tr><td>Ministry</td><td><span class="light">@ministry</span></td></tr>
        <tr><td>Local Pickup?</td><td><span class="light">@FormatBool(Model.IsLocalPickup)</span></td></tr>
        <tr><td>Applied</td><td><span class="light">@Html.DisplayFor(m=>m.SubmitDate)</span></td></tr>
        <tr><td>Paid</td><td><span class="light">@Html.DisplayFor(m=>m.PaymentDate)</span></td></tr>
        <tr><td>Delivered</td><td><span class="light">@Html.DisplayFor(m=>m.DeliverDate)</span></td></tr>
    </table>     
      
    <h2>Contact Details</h2>
    <div class="editor-field">
        @Html.EditorFor(model => model.FirstName)
        @Html.ValidationMessageFor(model => model.FirstName)
        @Html.EditorFor(model => model.LastName)
        @Html.ValidationMessageFor(model => model.LastName)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Email)
        @Html.ValidationMessageFor(model => model.Email)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Street)
        @Html.ValidationMessageFor(model => model.Street)
        @Html.EditorFor(model => model.Landmark)
        @Html.ValidationMessageFor(model => model.Landmark)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.City)
        @Html.ValidationMessageFor(model => model.City)
        @Html.EditorFor(model => model.State)
        @Html.ValidationMessageFor(model => model.State)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Country)
        @Html.ValidationMessageFor(model => model.Country)
        @Html.EditorFor(model => model.Zip)
        @Html.ValidationMessageFor(model => model.Zip)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.MobilePhone)
        @Html.ValidationMessageFor(model => model.MobilePhone)
        @Html.EditorFor(model => model.ResidentPhone)
        @Html.ValidationMessageFor(model => model.ResidentPhone)
    </div>      
    <div>
        <span class="back">You must include the country phone code.</span>
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Church)
        @Html.ValidationMessageFor(model => model.Church)
    </div>      
    <div class="editor-field">
        @Html.EditorFor(model => model.IsPastor)
        @Html.ValidationMessageFor(model => model.IsPastor)
        @Html.LabelFor(model => model.IsPastor, "Are you a pastor?")
    </div>      
    <br />
    <div>
        <input type="submit" value="Save" />
    </div>
}

<h1>Confirmation <span>Email</span></h1>
@using (Html.BeginForm("ConfirmationEmail", "Admin"))
{
    @Html.Hidden("ID", Model.ID)
    @Html.TextArea("Emails", Model.Email, new { placeholder = "Confirmation Email Addresses" })
    <div>
        <input type="submit" value="Send" />
    </div>
}

@helper FormatBool(bool b)
{
    var bb = b ? "Yes" : "No";
    @bb
}

@section Scripts {
    <style>
        table.compact td { padding: 2px 4px; line-height:initial; }
    </style>
    @Scripts.Render("~/bundles/jqueryval")
    @*@Scripts.Render("~/bundles/jquery")*@
}
